package com.ctshk.app.order.scenic.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.AppReq;
import com.ctshk.rpc.order.scenic.dto.ScenicOrderCollectionDTO;
import com.ctshk.rpc.order.scenic.dto.ScenicOrderCollectionReceiptDTO;
import com.ctshk.rpc.order.scenic.req.ScenicAddCheckOrderReq;
import com.ctshk.rpc.order.scenic.req.ScenicOrderCollectionConfirmationReq;
import com.ctshk.rpc.order.scenic.req.ScenicOrderCollectionReq;
import com.ctshk.rpc.order.scenic.req.ScenicOrderReceiptReq;
import com.ctshk.rpc.order.scenic.service.IScenicOrderCollectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import com.ctshk.common.web.support.BaseController;

import java.util.List;

/**
 * <p>
 * 门票收款明细 前端控制器
 * </p>
 *
 * @author 张志朋
 * @since 2021-02-24
 */
@Api(value="门票收款明细", tags="门票收款明细")
@RestController
@RequestMapping("/scenic/order/collection")
public class ScenicOrderCollectionController extends BaseController {

    @DubboReference
    private IScenicOrderCollectionService iScenicOrderCollectionService;

    @ApiOperation(value = "订单中心 - 操作订单收款记录", notes = "订单中心 - 操作订单收款记录(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.QUERY, operTitle = "订单中心 - 操作订单收款记录", operDesc = "订单中心 - 操作订单收款记录")
    @PostMapping(value = "/list")
    public Result<List<ScenicOrderCollectionDTO>> list(@RequestBody ScenicOrderCollectionReq scenicOrderCollectionReq){
        return iScenicOrderCollectionService.list(scenicOrderCollectionReq);
    }

    @ApiOperation(value = "订单中心 - 操作订单收款记录再次确认", notes = "订单中心 - 操作订单收款记录再次确认(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.UPDATE, operTitle = "订单中心 - 操作订单收款记录再次确认", operDesc = "订单中心 - 操作订单收款记录再次确认")
    @PostMapping(value = "/confirmation")
    public Result<Long> confirmation(@RequestBody ScenicOrderCollectionConfirmationReq scenicOrderCollectionConfirmationReq){
        return iScenicOrderCollectionService.confirmation(scenicOrderCollectionConfirmationReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "订单中心 - 收据详情", notes = "订单中心 - 收据详情(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.QUERY, operTitle = "订单中心 - 收据", operDesc = "订单中心 - 收据")
    @PostMapping(value = "/collection-receipt")
    public Result<ScenicOrderCollectionReceiptDTO> collectionReceipt(@RequestBody ScenicOrderReceiptReq scenicOrderReceiptReq){
        return iScenicOrderCollectionService.collectionReceipt(scenicOrderReceiptReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "订单中心 - 收据详情s", notes = "订单中心 - 收据详情")
    @GetMapping(value = "/collection-receipts/{orderId}")
    public Result<ScenicOrderCollectionReceiptDTO> collectionReceipts(@PathVariable("orderId") Long orderId){
        return iScenicOrderCollectionService.collectionReceipts(orderId);
    }

}
